<?php
use think\migration\Migrator;
use think\migration\db\Column;

class CreateNanobananaPrompts extends Migrator
{
    public function change()
    {
        $this->table('nanobanana_prompts', ['engine' => 'InnoDB', 'comment' => 'Nanobanana提示词预设表'])
            ->addColumn('category', 'string', ['limit' => 50, 'comment' => '分类：product/product_showcase/lifestyle/scene等'])
            ->addColumn('name', 'string', ['limit' => 100, 'comment' => '提示词名称'])
            ->addColumn('prompt', 'text', ['comment' => '提示词内容'])
            ->addColumn('description', 'string', ['limit' => 255, 'null' => true, 'comment' => '描述'])
            ->addColumn('image_size', 'string', ['limit' => 20, 'default' => '16:9', 'comment' => '推荐图片尺寸'])
            ->addColumn('sort', 'integer', ['default' => 0, 'comment' => '排序，数字越大越靠前'])
            ->addColumn('status', 'integer', ['limit' => 1, 'default' => 1, 'comment' => '状态：0禁用，1启用'])
            ->addColumn('create_time', 'timestamp', ['default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
            ->addColumn('update_time', 'timestamp', ['null' => true, 'comment' => '更新时间'])
            ->addIndex(['category'], ['name' => 'idx_category'])
            ->addIndex(['status'], ['name' => 'idx_status'])
            ->addIndex(['sort'], ['name' => 'idx_sort'])
            ->create();
    }
}

